package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswConventionalGood;

@Mapper
public interface TswConventionalGoodDao {

    @Select("select * from tsw_conventional_good t where t.id = #{id}")
    TswConventionalGood getById(Long id);

    @Delete("delete from tsw_conventional_good where id = #{id}")
    int delete(Long id);

    int update(TswConventionalGood tswConventionalGood);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_conventional_good(product_id, specifications_id, mail_id, actual_price, mall_type, itemupshelf_total, total_inventory, virtual_inventory, sales, return_wing, whether, universal_coupon, discount, goods_discount, theme_activities, css_id, create_time, creater, update_time, updater, conventional_note, conventional_remark) values(#{productId}, #{specificationsId}, #{mailId}, #{actualPrice}, #{mallType}, #{itemupshelfTotal}, #{totalInventory}, #{virtualInventory}, #{sales}, #{returnWing}, #{whether}, #{universalCoupon}, #{discount}, #{goodsDiscount}, #{themeActivities}, #{cssId}, #{createTime}, #{creater}, #{updateTime}, #{updater}, #{conventionalNote}, #{conventionalRemark})")
    int save(TswConventionalGood tswConventionalGood);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswConventionalGood> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
